<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
    
/**
* returns a string with the highlighted words of $search on $source.
* HTML is added to make the highlight.
* 
* @access protected 
* @param source 
* @param search 
* @return string 
*/

if ( ! function_exists('link_glossary_words'))
{

function link_glossary_wordsxxx($string, $ignoredterm=null) {
    
    $this->CI =& get_instance();   

        $this->db->select('Title_Glossary AS title, id_Glossary AS id')
                ->from('Glossary')
                ->where('Active_Glossary', 1);            

        $query = $this->db->get();

        return $query->result_array();


    $q="SELECT Title_Glossary FROM Glossary WHERE Active_Glossary='1'";
    $r=mysql_query($q);
    $n=mysql_numrows($r);
    $temppagename = "*tmppgnm*";
    
    for ($g=0; $g<$n; $g++) {
        $gterm = mysql_result($r,$g,"Title_Glossary");
        $underline = '<a href="'.$temppagename.'?term='.$gterm.'" class="UnderlineLink">\1</a>';
        if ($gterm != $ignoredterm) {
            //$string = str_highlight($string, $gterm, STR_HIGHLIGHT_WHOLEWD, $underline);
        }
    }
    
    $string = str_replace($temppagename, "glossary.php", $string);
    return $string;
    
/*          
    $this->load->model('glossarymodel');   
    $list = $this->glossarymodel->get_all_items();
    

    //$q="SELECT Title_Glossary FROM Glossary WHERE Active_Glossary='1'";
    //$r=mysql_query($q);
    //$n=mysql_numrows($r);
    $temppagename = "*tmppgnm*";
    
    //for ($g=0; $g<$n; $g++) {
    foreach($list as $item){

        echo $item." | ";
        //$underline = '<a href="'.$temppagename.'?term='.$gterm.'" class="UnderlineLink">\1</a>';
        //if ($gterm != $ignoredterm) {
        //    $string = str_highlight($string, $gterm, STR_HIGHLIGHT_WHOLEWD, $underline);
        //}
    }
    
    //$string = str_replace($temppagename, "glossary.php", $string);
    return $string;
*/
}

}
/* End of file order_helper.php */
/* Location: ./system/application/helpers/string_helper.php */